#export CROSS:=arm-hismall-linux-
export CROSS:=arm-hisiv100-linux-
export CC:=$(CROSS)gcc
export AR:=$(CROSS)ar


INC_FLAGS = -I./include
			
HEAD_FILES = ./include/*.h

CFLAGS  = -Werror -Wall -g -c -x c $(INC_FLAGS)

SRC  = $(notdir $(wildcard ./src/*.c))


OBJS    = $(SRC:%.c=%.o)
EXE     = libmsg.a

OBJPATH = $(PWD)/objs

VPATH   = $(PWD)/src
VPATH  += $(PWD)/objs
VPATH  += $(PWD)/include


$(OBJPATH)/$(EXE): $(OBJPATH) $(OBJS)
	cd $(OBJPATH); $(AR) r $(OBJPATH)/$(EXE) $(OBJS)
	cp -f $(OBJPATH)/$(EXE) ./lib/
	cd ./sample; make clean && make


$(OBJPATH):
	mkdir -p $(OBJPATH)


$(OBJS): %.o: %.c $(HEAD_FILES)
	$(CC)  $(CFLAGS) $< -Wall  -o $(OBJPATH)/$@


.PHONY:clean
clean:
	rm -rf $(OBJPATH)

